home *** CD-ROM | disk | FTP | other *** search
- function spaceEvenly(arrMCs, nmTop, nmBottom, nmMaxMargin, blnHorizontally)
- {
- blnHorizontally != null ? 0 : (blnHorizontally = 0);
- §§push("getEdge");
- if(!blnHorizontally)
- {
- }
- var §§pop() = §§pop();
- §§push("positionBeside");
- if(!blnHorizontally)
- {
- }
- var §§pop() = §§pop();
- var nmTotalHeights = 0;
- var len = arrMCs.length;
- var a = 0;
- while(a < len)
- {
- nmTotalHeights += !blnHorizontally ? arrMCs[a]._height : arrMCs[a]._width;
- a++;
- }
- var nmMargin = (nmBottom - nmTop - nmTotalHeights) / (len - 1);
- if(nmMaxMargin != null && nmMargin > nmMaxMargin)
- {
- nmMargin = nmMaxMargin;
- }
- !blnHorizontally ? (arrMCs[0]._y = nmTop) : (arrMCs[0]._x = nmTop);
- var a = 1;
- while(a < len)
- {
- positionBeside(arrMCs[a],arrMCs[a - 1],nmMargin);
- a++;
- }
- }
- function spaceVertically(arrMCs, nmTop, nmBottom, nmMaxMargin)
- {
- var nmTotalHeights = 0;
- var len = arrMCs.length;
- var a = 0;
- while(a < len)
- {
- nmTotalHeights += arrMCs[a]._height;
- a++;
- }
- var nmMargin = (nmBottom - nmTop - nmTotalHeights) / (len - 1);
- if(nmMaxMargin != null && nmMargin > nmMaxMargin)
- {
- nmMargin = nmMaxMargin;
- }
- arrMCs[0]._y = nmTop;
- var a = 1;
- while(a < len)
- {
- arrMCs[a].positionUnder(arrMCs[a - 1],nmMargin);
- a++;
- }
- }
- function SectionsList(xmlNode)
- {
- var len = xmlNode.childNodes.length;
- var nd;
- var S;
- var n = 0;
- while(n < len)
- {
- nd = xmlNode.childNodes[n];
- S = this[nd.attributes.id] = {};
- for(var a in nd.attributes)
- {
- S[a] = nd.attributes[a];
- }
- if(nd.hasChildNodes())
- {
- S.label = nd.getText();
- }
- S.index = n;
- n++;
- }
- this.length = xmlNode.childNodes.length;
- ASSetPropFlags(this,"length",1);
- return this;
- }
- function ColorsObject(node)
- {
- var makeDictionaryObject = function(node)
- {
- var len = node.childNodes.length;
- var objDict = {};
- var nd;
- var n = 0;
- while(n < len)
- {
- nd = node.childNodes[n];
- objDict[nd.attributes.id] = nd.attributes.value;
- n++;
- }
- return objDict;
- };
- this.__data = makeDictionaryObject(node);
- return this;
- }
- _global.resolvePath = function(path)
- {
- if(path.indexOf("../") == -1)
- {
- return path;
- }
- var arr = path.split("/");
- var i = 1;
- while(i < arr.length)
- {
- var p = arr.indexOf("..",i);
- if(p > 0)
- {
- if(arr[p - 1] != "..")
- {
- arr.splice(p - 1,2);
- }
- else
- {
- i++;
- }
- }
- else
- {
- i = arr.length;
- }
- }
- return arr.join("/");
- };
- MovieClip.prototype.__olm = MovieClip.prototype.loadMovie;
- MovieClip.prototype.loadMovie = function(strURL, strMethod)
- {
- strURL = resolvePath(strURL);
- this.__olm(strURL,strMethod);
- };
- Sound.prototype.__ols = Sound.prototype.loadSound;
- Sound.prototype.loadSound = function(strURL, blnStreaming)
- {
- strURL = resolvePath(strURL);
- this.__ols(strURL,blnStreaming);
- };
- XML.prototype.__ol = XML.prototype.load;
- XML.prototype.load = function(strURL)
- {
- strURL = resolvePath(strURL);
- this.__ol(strURL);
- };
- TextField.prototype.replaceText = function(str)
- {
- Selection.setFocus(this);
- Selection.setSelection(0,0);
- this.replaceSel(str);
- Selection.setSelection(str.length,this.length);
- this.replaceSel(" ");
- Selection.setFocus(null);
- };
- TextField.prototype.resize = function()
- {
- this.autoSize = true;
- var h = this.textHeight + 10;
- this.autoSize = false;
- this._height = h;
- };
- MovieClip.prototype.getBottom = function()
- {
- return parseInt(this._y + this._height);
- };
- Button.prototype.getBottom = TextField.prototype.getBottom = MovieClip.prototype.getBottom;
- MovieClip.prototype.positionUnder = function(objUnder, margin)
- {
- if(margin == null)
- {
- margin = 0;
- }
- this._y = objUnder.getBottom() + margin;
- };
- Button.prototype.positionUnder = TextField.prototype.positionUnder = MovieClip.prototype.positionUnder;
- Object.prototype.dump = function()
- {
- var strOut = "--- Start object dump ---\n";
- for(var i in this)
- {
- strOut += i + " : " + this[i] + "\n";
- }
- strOut += "--- End object dump ---";
- trace(strOut);
- };
- Array.prototype.indexOf = function(val, from)
- {
- var len = this.length;
- if(from == null)
- {
- from = 0;
- }
- var i = from;
- while(i < len)
- {
- if(this[i] == val)
- {
- return i;
- }
- i++;
- }
- return -1;
- };
- Array.prototype.lastIndexOf = function(val, from)
- {
- var len = this.length;
- if(from == null)
- {
- from = len;
- }
- var i = from;
- while(i >= 0)
- {
- if(this[i] == val)
- {
- return i;
- }
- i--;
- }
- return -1;
- };
- String.prototype.replace = function(srch, repl)
- {
- return this.split(srch).join(repl);
- };
- MovieClip.prototype.pause = function(nm)
- {
- clearInterval(this.nmPauseID);
- this.stop();
- this.nmPauseID = setInterval(this,"unpause",nm);
- this.onUnload = function()
- {
- clearInterval(this.nmPauseID);
- };
- };
- MovieClip.prototype.unpause = function()
- {
- clearInterval(this.nmPauseID);
- this.play();
- };
- MovieClip.prototype.disableButtons = function()
- {
- for(var o in this)
- {
- if(this[o].__proto__ == Button.prototype)
- {
- this[o].enabled = false;
- }
- }
- };
- MovieClip.prototype.enableButtons = function()
- {
- for(var o in this)
- {
- if(this[o].__proto__ == Button.prototype)
- {
- this[o].enabled = true;
- }
- }
- };
- MovieClip.prototype.removeAllMovieClips = function()
- {
- for(var m in this)
- {
- if(typeof this[m] == "movieclip")
- {
- this[m].removeAllMovieClips();
- this[m].removeMovieClip();
- }
- }
- };
- Color.prototype.reset = function()
- {
- var objReset = {ab:0,aa:100,bb:0,ba:100,gb:0,ga:100,rb:0,ra:100};
- this.setTransform(objReset);
- };
- ASSetPropFlags(Object.prototype,"dump",1);
- ASSetPropFlags(MovieClip.prototype,"getBottom,positionUnder,pause,unpause,disableButtons,enableButtons,removeAllMovieClips,__olm",1);
- ASSetPropFlags(TextField.prototype,"getBottom,positionUnder,resize",1);
- ASSetPropFlags(Button.prototype,"getBottom,positionUnder",1);
- ASSetPropFlags(Array.prototype,"indexOf,lastIndexOf",1);
- ASSetPropFlags(Sound.prototype,"__ols",1);
- ASSetPropFlags(XML.prototype,"__ol",1);
- MovieClip.prototype.addOnLoadHandler = function(path, func)
- {
- if(MovieClip._onLoadHandler_ == undefined)
- {
- MovieClip._onLoadHandler_ = {};
- }
- if(func == null)
- {
- delete MovieClip._onLoadHandler_[path];
- }
- else
- {
- MovieClip._onLoadHandler_[path] = func;
- }
- };
- ASSetPropFlags(MovieClip,["addOnLoadHandler"],1);
- sol = function(func)
- {
- addOnLoadHandler(this,func);
- };
- gol = function()
- {
- return MovieClip._onLoadHandler_[this];
- };
- MovieClip.prototype.addProperty("onLoad",gol,sol);
- MovieClip.prototype.addOnReadyHandler = function(path, func)
- {
- if(MovieClip._onReadyHandler_ == undefined)
- {
- MovieClip._onReadyHandler_ = {};
- }
- if(func == null)
- {
- delete MovieClip._onReadyHandler_[path];
- }
- else
- {
- MovieClip._onReadyHandler_[path] = func;
- }
- };
- ASSetPropFlags(MovieClip,["addOnReadyHandler"],1);
- sor = function(func)
- {
- addOnReadyHandler(this,func);
- };
- gor = function()
- {
- return MovieClip._onReadyHandler_[this];
- };
- MovieClip.prototype.addProperty("onReady",gor,sor);
- XML.prototype.ignoreWhite = true;
- XMLnode.prototype.byID = function(id)
- {
- var len = this.childNodes.length;
- var e = 0;
- while(e < len)
- {
- var el = this.childNodes[e];
- if(el.attributes.id == id)
- {
- return el;
- }
- e++;
- }
- return null;
- };
- XMLnode.prototype.byName = function(name)
- {
- var len = this.childNodes.length;
- var e = 0;
- while(e < len)
- {
- var el = this.childNodes[e];
- if(el.nodeName == name)
- {
- return el;
- }
- e++;
- }
- return null;
- };
- XMLnode.prototype.byIndex = function(index)
- {
- if(this.childNodes[index])
- {
- return this.childNodes[index];
- }
- return null;
- };
- XMLnode.prototype.getText = function()
- {
- return this.firstChild.nodeValue;
- };
- XMLnode.prototype.byPath = function(path)
- {
- var tmp = this;
- var arrPath = path.split("/");
- var len = arrPath.length;
- var n = 0;
- while(n < len)
- {
- var str = arrPath[n];
- if(str.charAt(0) == "@")
- {
- tmp = tmp.byID(str.substring(1));
- }
- else if(str.charAt(0) == "#")
- {
- tmp = tmp.byIndex(parseInt(str.substring(1)));
- }
- else
- {
- tmp = tmp.byName(str);
- }
- if(!tmp)
- {
- return undefined;
- }
- n++;
- }
- return tmp;
- };
- ASSetPropFlags(XML.prototype,"byID,byName,byIndex,byPath,getText",1);
- SectionsList.prototype.indexOf = function(str)
- {
- var i = this.length - 1;
- for(var o in this)
- {
- if(this[o].id == str)
- {
- return i;
- }
- i--;
- }
- return -1;
- };
- SectionsList.prototype.item = function(nm)
- {
- var i = this.length - 1;
- for(var o in this)
- {
- if(i == nm)
- {
- return this[o];
- }
- i--;
- }
- return null;
- };
- ASSetPropFlags(SectionsList.prototype,"item,indexOf",1);
- ColorsObject.prototype.__getString = function(str)
- {
- var val = this.__data[str];
- if(val == null)
- {
- if(str.charAt(0) != "#" || str.length != 7)
- {
- error("ColorsObject : color \'" + str + "\' not recognised");
- return null;
- }
- val = str.substring(1);
- }
- return val;
- };
- ColorsObject.prototype.getString = function(str)
- {
- return "#" + this.__getString(str);
- };
- ColorsObject.prototype.getHex = function(str)
- {
- return parseInt("0x" + this.__getString(str));
- };
- _global.fade = function(soundToFade, volumeToSet)
- {
- onEnterFrame = function()
- {
- if(soundToFade.getVolume() > volumeToSet)
- {
- soundToFade.setVolume(soundToFade.getVolume() - 5);
- }
- else if(soundToFade.getVolume() < volumeToSet)
- {
- soundToFade.setVolume(soundToFade.getVolume() + 1);
- }
- if(soundToFade.getVolume() <= 0)
- {
- soundToFade.stop();
- delete soundToFade;
- delete this.onEnterFrame;
- }
- else if(soundToFade.getVolume() == volumeToSet)
- {
- delete this.onEnterFrame;
- }
- };
- };
- if(PLAY_MODE == undefined)
- {
- PLAY_MODE = CustomActions == null ? "director" : "authoring";
- }
- if(PLAY_MODE == "director")
- {
- _global.lingo = function(str)
- {
- getURL("lingo:" + str,"");
- };
- }
- else if(PLAY_MODE == "browser")
- {
- _global.lingo = function(str)
- {
- };
- _global.statusBar = function(str)
- {
- getURL("javascript:void(window.status=\'" + str + "\')","");
- };
- }
- ISSUE_XMLFILE = "../../assets/xml/issue.xml";
- PROMOS_XMLFILE = "xml/promos.xml";
- _global.Tardis = this;
-